package novemberBot.utils;

import lejos.nxt.Button;
import novemberBot.FactoryFloorRobot;
import novemberBot.navigation.Navigator;
import novemberBot.navigation.Odometer;
/**class used primarily to calibrate robo constants and test different systems
 * @author Antoine Lennartz*/
public class CalibrationUnit {
	/**link to robot object*/
	public static FactoryFloorRobot ffr = FactoryFloorRobot.getInstance();
	/**link to Navigator Object*/
	public static Navigator theCaptain = ffr.getNavigator();
	/**link to odometer object*/
	public static Odometer odo = ffr.getOdometer();
	
	/**drives in straight line error is used to calibrate wheel radii*/
	public static void odoWheelRadius(){
		while(true){
			theCaptain.setForward(5*30.48, false);
			Button.waitForPress();
			odo.setPosition(new double[]{0,0,0}, new boolean[]{true, true, true});		
		}
	}
	/**drives in circles error is used to calibrate wheel base*/
	public static void odoWheelBase(){
		while(true){
			for(int i=0; i<5; i++){
				theCaptain.setRotation(170, false);
				theCaptain.setRotation(340, false);
				theCaptain.setRotation(0, false);
			}
			Button.waitForPress();
			odo.setPosition(new double[]{0,0,0}, new boolean[]{true, true, true});	
		}
	}
	/**drives in straight line error is used to calibrate wheel radii*/
	public static void roboWheelRadius(){
		while(true){
			ffr.roll((int) (5*30.48), 150, false);
			Button.waitForPress();
		}
	}
	/**drives in circles error is used to calibrate wheel base*/
	public static void roboWheelBase(){
		while(true){
			ffr.turn(360*5, 150, false);
			Button.waitForPress();
		}
	}
	
}
